<%@page import="org.zg.library.entity.Users"%>
<%@page import="java.util.List"%>
<%@page import="org.zg.library.util.Page"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
</head>  
	<body>
    	<div class="x-body">
      		<table class="layui-table">
          		<tr>                       			
					<th>ID</th>
					<th>用户名</th>
					<th>密码</th>
					<th>性别</th>
					<th>电话</th>
					<th>住址</th>
					<th>注册时间</th>
				<tr>
<%-- 				<%
			    	Page pages = (Page)request.getAttribute("page");
 			        //总页数
			        int totalPages = pages.getTotalPage();
			        //当前页的页码
			        int pageIndex = pages.getCurrentPage();
			        //获取当前页中用户数据的集合
			        List<Users> users = pages.getUsers(); 
			        if(users!=null){
			        	for(Users u:users){
			    %>			
			     	<tr>
			     		<td><%=u.getU_id() %></td>
			     		<td><%=u.getU_name() %></td>
			     		<td><%=u.getU_pwd() %></td>
			     		<td><%=u.getU_sex() %></td>
			     		<td><%=u.getU_tel() %></td>
			     		<td><%=u.getU_loc() %></td>
			     		<td><%=u.getU_date() %></td>
			     	</tr>			     
			        			
			    <%			
			        	}
			        }
			    %>   --%>
			    <c:forEach var="ss" items="${requestScope.page.users}">
			    	<tr>
			    		<td>${ss.u_id}</td>
			    		<td>${ss.u_name}</td>
			    		<td>${ss.u_pwd}</td>
			    		<td>${ss.u_sex}</td>
			    		<td>${ss.u_tel}</td>
			    		<td>${ss.u_loc}</td>
			    		<td>${ss.u_date}</td>
			    	</tr>
			    </c:forEach>			    					 
			</table>			
    	</div>
    	<div class="page">
        	<div>
	        	<%-- <%
	        		for(int i=1;i<=totalPages;i++){
	        	%>
	        			<a href="SelectAllUsersServlet?currentPage=<%=i %>"><%=i %></a>		
	        	<%		
	        		}	        	
	        	%> --%>
	        	<c:out value="<a href='SelectAllUsersServlet?currentPage=1'>首页</a>" escapeXml="false"/>
	        	<c:choose>
	        		<c:when test="${page.currentPage>1}">
	        			<c:out value="<a href='SelectAllUsersServlet?currentPage=${page.currentPage-1}'>上一页</a>" escapeXml="false"/>						        			
	        		</c:when>	       		
	        		<c:otherwise>
	        			<a>上一页	</a>	        								        				        			
	        		</c:otherwise>
	        		<c:when test="${page.currentPage=}"></c:when>
	        	</c:choose>
        	</div>
      </div>
  	</body>
</html>